-- SPDX-License-Identifier: GPL-3.0-or-later

local v_cangcong = fk.CreateSkill {
  name = "v_cangcong",
  tags = {  },
}

--时机：目标确定后
v_cangcong:addEffect(fk.TargetConfirmed, {
  --赋予防御型技能定义
  anim_type = "defensive",
  events = {fk.TargetConfirmed},
  --触发条件：触发时机的角色为遍历到的角色、遍历到的角色具有本技能、牌的种类为杀/锦囊牌、牌的目标>1。
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(v_cangcong.name) and
      (data.card.trueName == "slash" or (data.card.type == Card.TypeTrick and
      data.card.sub_type ~= Card.SubtypeDelayedTrick)) and
      #data:getAllTargets() > 1
  end,
  on_use = function(self, event, target, player, data)
    -- local room = player.room
    -- local address = "./packages/VirtualSlash/image/anim/skill_nullify"
    -- room:setEmotion(player, address)
    data:setNullified(player)
  end,
})

-- TODO:等官方搞出基础AI再说吧，现在不算很靠谱
-- v_cangcong:addAI({
--   think_skill_invoke = function(self, ai, skill_name, prompt)
--     -- ---@type UseCardData
--     -- local card = ai.data
--     -- for i, v in ipairs(card) do
--     --   print(i,v)
--     -- end
--     -- local isFriend = ai:isFriend(player)
--     -- dbg()
--     return true
--     -- if card == "god_salvation" or card == "amazing_grace" then
--     --   return false
--     -- else
--     --   return true
--     -- end
--   end,
-- })

return v_cangcong